package com.mechat.util

import com.custom.base.config.BaseConfig
import com.custom.base.entity.OkHttpBodyEntity
import com.custom.base.http.OkHttpFromBoy
import com.custom.base.http.OkHttpManager
import com.custom.base.http.SDOkHttpResoutCallBack
import com.mechat.entity.BaseEntity
import io.rong.imkit.API
import io.rong.imkit.SpName

object HttpRequest {

    fun commonNotify(source:String,content:String){
        try {
            if (BaseConfig.getInstance.getBoolean(SpName.openNotify,true)) {
                OkHttpManager.instance.requestInterface(object : OkHttpFromBoy {
                    override fun addBody(requestBody: OkHttpBodyEntity) {
                        requestBody.setGet(API.user_common_notify_url+"/"+BaseConfig.getInstance.getString("userCode", ""))
                        requestBody.add("source", source)
                        requestBody.add("name", content)
                    }
                }, object : SDOkHttpResoutCallBack<BaseEntity>(false) {
                    override fun onSuccess(entity: BaseEntity) {
                    }
                })
            }
        }catch (e:Exception){

        }

    }
}